export function formatCount(count) {
    count = parseInt(count);
    if (count >= 100000000) {
        return (count / 100000000).toFixed(1) + '亿';
    } else if (count >= 10000) {
        return (count / 10000).toFixed(1) + '万';
    } else {
        return count;
    }
}
function padStart(minute) {
    return ('00' + minute).slice(minute.toString().length);
}
function padEnd(minute) {
    if (minute < 10) {
        return '0' + minute;
    } else {
        return minute;
    }
}
export function formatDuration(duration) {
    duration = parseInt(duration / 1000);
    var minute = Math.floor(duration / 60);
    var second = duration % 60;
    return padStart(minute) + ':' + padEnd(second);
}

export function debounce(func, duration) {
    let timer = null;
    console.log(timer);
    return (...args) => {
        console.log('创建实例')
        return new Promise(resolve => {
            clearTimeout(timer);
            timer = setTimeout(() => {
                resolve(func.call(this, ...args));
            }, duration);
        })
    }
}